<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-minimal.min.css">
  <script src="/lib/pace/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"sekla.cn","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":"valine","storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="1231.假设寄存器%dh的值为0xf9,%eax的值为0xa1984d90,执行以下指令  movsbl  %dh,%eax  %eax的值为______(以十六进制小写字符格式表示例0xffffffff该题请补齐八位)。  movsbl指令负责拷贝一个字节，并用源操作数的最高位填充其目的操作数中的其余各位，这种扩展方式叫符号扩展。 另外还有一个是movzbl指令，它也是拷贝一个字节，但填充时用">
<meta property="og:type" content="article">
<meta property="og:title" content="CSAPP第一次作业">
<meta property="og:url" content="http://sekla.cn/2021/04/14/csapphw1/index.html">
<meta property="og:site_name" content="Sekla&#39;s Blog">
<meta property="og:description" content="1231.假设寄存器%dh的值为0xf9,%eax的值为0xa1984d90,执行以下指令  movsbl  %dh,%eax  %eax的值为______(以十六进制小写字符格式表示例0xffffffff该题请补齐八位)。  movsbl指令负责拷贝一个字节，并用源操作数的最高位填充其目的操作数中的其余各位，这种扩展方式叫符号扩展。 另外还有一个是movzbl指令，它也是拷贝一个字节，但填充时用">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-04-14T04:34:15.000Z">
<meta property="article:modified_time" content="2021-10-18T14:42:01.498Z">
<meta property="article:author" content="Sekla">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://sekla.cn/2021/04/14/csapphw1/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>CSAPP第一次作业 | Sekla's Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

  <script type="text/javascript" src="/js/my_js/clicklove.js"></script>
<!-- hexo injector head_end start -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hexo-math@4.0.0/dist/style.css">
<!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Sekla's Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">Keep Learning Keep Doing</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">14</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">23</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">100</span></a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://sekla.cn/2021/04/14/csapphw1/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="Sekla">
      <meta itemprop="description" content="Sekla">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Sekla's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          CSAPP第一次作业
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-04-14 12:34:15" itemprop="dateCreated datePublished" datetime="2021-04-14T12:34:15+08:00">2021-04-14</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-10-18 22:42:01" itemprop="dateModified" datetime="2021-10-18T22:42:01+08:00">2021-10-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F/" itemprop="url" rel="index"><span itemprop="name">计算机系统</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span><br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>3.5k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>3 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span>假设寄存器%dh的值为<span class="number">0xf9</span>,%eax的值为<span class="number">0xa1984d90</span>,执行以下指令 </span><br><span class="line"> movsbl  %dh,%eax </span><br><span class="line"> %eax的值为______(以十六进制小写字符格式表示例<span class="number">0xffffffff</span>该题请补齐八位)。</span><br></pre></td></tr></table></figure>

<p>movsbl指令负责拷贝一个字节，并用源操作数的最高位填充其目的操作数中的其余各位，这种扩展方式叫符号扩展。</p>
<p>另外还有一个是movzbl指令，它也是拷贝一个字节，但填充时用的是0填充。0xf9最高位为f，填充之后为0xfffffff9</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">2.</span>假设寄存器 %ebx的值为<span class="number">0x8a8a16d4</span>,执行以下指令后 </span><br><span class="line"> movl   %ebx,%ecx </span><br><span class="line"> movw   $<span class="number">0x8a97</span>,%bx </span><br><span class="line"> movb   $<span class="number">0x85</span>,%bl</span><br><span class="line"> cmpl   %ecx,%ebx </span><br><span class="line"> jae    .L1 </span><br><span class="line"> addl   $<span class="number">0x8</span>,%ebx </span><br><span class="line"> jmp    .L2  </span><br><span class="line"> .L1: </span><br><span class="line"> subl   $<span class="number">0x9</span>,%ebx </span><br><span class="line"> .L2:</span><br><span class="line"></span><br><span class="line"> %ebx的值为______(以十六进制格式小写表示例<span class="number">0xffffffff</span>)。</span><br></pre></td></tr></table></figure>

<p>movl传4个字节,movw传2个字节，也就是16位，ebx为0x8a8a16d4，ecx也为0x8a8a16d4，接下来改变bx的值，movb传送1个人字节0x85到bl，所以ebx变为0x8a8a8a85,比较ecx和ebx，然后ebx为ebx=ebx-0x9=0x8a8a8a7c</p>
<a id="more"></a>

<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">3.已知寄存器及其现有值如下：</span><br><span class="line">EAX&#x3D;0x0cfaf8c1, EDX&#x3D;0x54a1da65。指令movzbl %dh, %eax执行完后，EAX&#x3D;_______？(如果无法通过编译，答案填 &quot;错误，编译不能通过&quot;  否则答案格式形如0xffffffff).</span><br></pre></td></tr></table></figure>

<p>movzbl，拷贝一个字节，填充用0填充，dh为8位寄存器 dh=0xda,eax=0x000000da</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">4。已知寄存器%eax中的值为0x6d3d5290,%ebx中的值为0xf62bd1a1,%ecx的值为0x384b8e22,%edx的值为0x38331178。</span><br><span class="line">求下列操作数的值（十进制）:</span><br><span class="line">0x32(,%eax,4)</span><br></pre></td></tr></table></figure>

<p>寄存器寻址,应该为%eax·4+0x32=0x1b4f54a72，位数溢出，因此截断为0xb4f54a72,化为十进制为-1258993038</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">5.</span>某程序中有整形变量a=<span class="number">0xe7947e43</span>, b=<span class="number">0x3b16bd19</span>, c=<span class="number">0xccf60316</span>, d=<span class="number">0x9d8ec7de</span></span><br><span class="line">程序代码中有如下语句：</span><br><span class="line">b=&amp;a;</span><br><span class="line">d=&amp;c;</span><br><span class="line">a=a+<span class="number">0xf48a51f8</span>;</span><br><span class="line">*d=*b；</span><br><span class="line">则此时语句 <span class="built_in">printf</span>(“c=%d\n”, c); 给出结果为：（十进制）</span><br></pre></td></tr></table></figure>

<p>首先b取a的地址，d取c的地址，a=a+0xf48a51f8=0x1DC1ED03B，然后将b的地址赋给d的地址，a=0x1DC1ED03B，舍去最高位，c=0xdc1ed03b=-601960389</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"> <span class="number">6.</span>根据操作数特点，用恰当的MOV类指令补全下列残缺数据传送指令：</span><br><span class="line">_______ %eax,%ebx</span><br><span class="line">_______ %eax,%bx</span><br><span class="line">_______ %eax,%ecx（格式形如:movl)</span><br></pre></td></tr></table></figure>

<p>movl  movw  movl</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">7.</span>已知%eax=<span class="number">0X100</span>,%ebx=<span class="number">0X3</span>;</span><br><span class="line">内存中指定地址的值列表如下：</span><br><span class="line">地址	    值</span><br><span class="line"><span class="number">0X100</span>	<span class="number">0X23</span></span><br><span class="line"><span class="number">0X104</span>	<span class="number">0XA0</span></span><br><span class="line"><span class="number">0X108</span>	<span class="number">0XE5</span></span><br><span class="line"><span class="number">0X10C</span>	<span class="number">0X2B</span></span><br><span class="line">则指令 addl <span class="number">0XF3</span>,(%eax,%ebx,<span class="number">4</span>)将地址__________中的值更新为___________。</span><br><span class="line">(格式为<span class="number">16</span>进制大写。)</span><br></pre></td></tr></table></figure>

<p>将地址ebx·4+eax中的值加0xf3并加载到该地址上，计算得0x10c与0x11e</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">8.</span>%ah中存有某变量值<span class="number">0xad</span>。则指令 SHR $<span class="number">5</span>, %ah 执行后 %ah = _____。(答案格式形如<span class="number">0x00</span>)</span><br></pre></td></tr></table></figure>

<p>逻辑左移5位，0x05</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">9</span>一个c代码文件e.c，需要经过预处理（输出e.i)、编译(输出e.s)、汇编(输出e.o)、链接(输出e.out可执行文件)四个步骤。</span><br><span class="line">假设e.c的源代码如下：</span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> (stdio.h)</span></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line"> <span class="keyword">int</span> x=<span class="number">1</span></span><br><span class="line"> <span class="keyword">double</span> y=<span class="number">1</span>;</span><br><span class="line"> <span class="built_in">printf</span>(<span class="string">&quot;%f&quot;</span>,&amp;y);</span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br><span class="line">则预处理阶段______出错；</span><br><span class="line">在处理完预处理阶段的问题（如果有的话）并通过后，编译阶段______出错；</span><br><span class="line">在处理完编译阶段的问题（如果有的话）并通过后，汇编阶段_______出错；</span><br><span class="line">在处理汇编阶段的问题（如果有的话）并通过后，链接阶段______出错。（填“会”或“不会”）</span><br></pre></td></tr></table></figure>

<p>第一行语法错误，会找不到指定头文件，预处理出错，预处理后，编译发现int x=1语法错误，编译失败。编译成功后以后步骤不会失败。</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">在某机器中，用<span class="number">12</span>位存储浮点数，并按照IEEE754标准表示，其中阶码占<span class="number">6</span>位，则阶码偏移值为__（用十进制表示）</span><br><span class="line">在所有的正数中，最大的非规格化值为__（用二进制表示)</span><br></pre></td></tr></table></figure>

<p>12位浮点数，1位符号位，6位阶码，5位尾数，阶码偏置值应为bias=2^6/2-1=31,最大的非规格化数应为000000011111</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">已知%eax=<span class="number">0xc27fd632</span>,%ebx=<span class="number">0x79fa2169</span>,%ecx=<span class="number">0x71cac137</span>,%edx=<span class="number">0x3c91d17c</span>,%esp=<span class="number">0x849bdbc1</span></span><br><span class="line">在执行如下一系列语句后：</span><br><span class="line">pushl %eax</span><br><span class="line">pushw %bx</span><br><span class="line">popl %ebx</span><br><span class="line">pushw %dx</span><br><span class="line">pushw %ax</span><br><span class="line">popl %ebx</span><br><span class="line">pushl %ecx</span><br><span class="line">则%esp的值为<span class="number">0</span>x__,%eax=<span class="number">0</span>x__,%ebx=<span class="number">0</span>x__,%ecx=<span class="number">0</span>x___,%edx=<span class="number">0</span>x____,</span><br><span class="line">内存<span class="number">0x849bdbc1</span><span class="number">-0x1</span>处存放的值为<span class="number">0</span>x__</span><br><span class="line">（所有十六进制数用小写字母，所有答案不带<span class="number">0</span>x,用一个英文空格分隔答案）</span><br></pre></td></tr></table></figure>

<p>根据push操作后缀可知字节数，则esp=esp+4+2-4+2+2-4+4=esp-6，则esp=0x849bdbbb，eax=0xc27fd632，ebx=0xd17cd632</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">假设在%ah中存放的值为<span class="number">0x2e</span>,%al中存放的值为<span class="number">0x74</span></span><br><span class="line">则在执行cmpb %ah,%al后</span><br><span class="line">SF=____,OF=____,CF=____,ZF=____.(填<span class="number">0</span>或<span class="number">1</span>,例如<span class="number">0</span> <span class="number">0</span> <span class="number">0</span> <span class="number">1</span>)</span><br></pre></td></tr></table></figure>

<p>比较ah,al的值，al-ah&gt;0，固SF=0 OF=0 CF=0 ZF=0</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">已知%eax=<span class="number">0x6b533c1e</span>,%ebx=<span class="number">0xc3740e3f</span>,%ecx=<span class="number">0xd7177729</span>,%edx=<span class="number">0x784f7dae</span>,%esp=<span class="number">0xbb515e94</span></span><br><span class="line">在执行如下一系列语句后：</span><br><span class="line">pushl %ebx</span><br><span class="line">pushw %dx</span><br><span class="line">popl %ebx</span><br><span class="line">pushw %dx</span><br><span class="line">pushl %ecx</span><br><span class="line">popw %ax</span><br><span class="line">内存<span class="number">0xbb515e91</span>处存放的值为<span class="number">0</span>x____</span><br></pre></td></tr></table></figure>


<p>经过操作后，esp应该减少8，0xbb515e90开始为%ebx的值，ebx为0xc3749e3f，则多一个字节地址上数值应该为0x74</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">0x6583ccd1</span>存放在采用大端存储的机器上，地址为 <span class="number">0x9564</span>到 <span class="number">0x9567</span>，则 <span class="number">0x9566</span>处存放值为______(以十六进制小写格式表示例<span class="number">0xffffffff</span>)。</span><br></pre></td></tr></table></figure>

<p>大端法存储，最高有效位在最低地址处，明显是0xcc</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">执行指令IMUL  %eax，%edx，其中%eax为<span class="number">0x57c00cec</span>，%edx为<span class="number">0x16216c6c</span>,%edx结果为______(以十六进制小写格式表示例<span class="number">0xffffffff</span>)。</span><br></pre></td></tr></table></figure>

<p>IMUL有符号数乘法，%edx存储最后的乘法结果,0x57c00cec十进制为1472204012，0x16216c6c十进制为371289196，结果为546,613,443,963,454,352，32位下超出数位限制溢出，高位被截断，保留32位，结果为-2,095,383,440表示为16进制为0xfce50390</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">执行以下指令，最终%eax的结果为______(以十六进制格式小写表示例<span class="number">0xffffffff</span>)。</span><br><span class="line">movl $<span class="number">0x9494bf35</span>,%edx</span><br><span class="line">movl $<span class="number">0x3a57d6a1</span>,%eax</span><br><span class="line">cmpl %eax,%edx</span><br><span class="line">jge  .L2</span><br><span class="line">subl  %edx,%eax</span><br><span class="line">jmp  .L3</span><br><span class="line">.L2:</span><br><span class="line">subl  %eax,%edx</span><br><span class="line">movl  %edx,%eax</span><br><span class="line">.L3:</span><br></pre></td></tr></table></figure>

<p>将两个数分别移动到edx和eax寄存器中，随后进行比较，显然edx&gt;eax，jge进行无符号跳转，所以跳转到L2,edx=eax-edx=FFFF FFFF A5C3 176C，截断得0xA5C3176C。</p>

    </div>
    
    
    

      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/12/12/lcdf_end/" rel="prev" title="数电的最后lab--简易CPU">
      <i class="fa fa-chevron-left"></i> 数电的最后lab--简易CPU
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/04/14/datas-tree/" rel="next" title="树的一些总结">
      树的一些总结 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Sekla"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">Sekla</p>
  <div class="site-description" itemprop="description">Sekla</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">100</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">23</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/ShenTiao" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;ShenTiao" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:584892986@qq.com" title="E-Mail → mailto:584892986@qq.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



      </div>

      <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=1416875904&auto=0&height=66"></iframe>
      
    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Sekla</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">288k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">4:22</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script size="300" alpha="0.6" zIndex="-1" src="/lib/canvas-ribbon/canvas-ribbon.js"></script>
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  

  

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/shizuku.model.json"},"display":{"position":"left","width":250,"height":500},"mobile":{"show":false},"react":{"opacity":0.9},"log":false});</script></body>
</html>

<script type="text/javascript" src="/js/src/love.js"></script>
